import org.mindrot.jbcrypt.BCrypt;

public class Main {
    public static void main(String[] args) {
        // 注册：传入明文密码
        // 1. 得到盐值
        String plainPassword = "x";
        String salt = BCrypt.gensalt();
        System.out.println(salt);
        String hashpw = BCrypt.hashpw(plainPassword, salt);
        System.out.println(hashpw);
        System.out.println(hashpw.length());

        // $2a$10$YMibLshYU6fqLztrVB5UeuQADPXArfGnlXE.GCPlLwyPMSERwZyD6
        // 登录：传入明文密码
//        String plainPassword = "123455";
//        String hashpw = "$2a$10$YMibLshYU6fqLztrVB5UeuQADPXArfGnlXE.GCPlLwyPMSERwZyD6";
//        System.out.println(hashpw.length());
//        boolean checkpw = BCrypt.checkpw(plainPassword, hashpw);
//        System.out.println(checkpw);
    }
}
